<%@ page import="util.DBUtil" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%
    request.setCharacterEncoding("utf-8");//设置字符集
    //1.获得录入表单传递的数据
    String typeId       =request.getParameter("type_id");
    String productName  =request.getParameter("product_name");
    String intro        =request.getParameter("intro");
    String price        =request.getParameter("price");
    String salePrice    =request.getParameter("sale_price");
    String isTop        =request.getParameter("is_top");
    String idx          =request.getParameter("idx");
    String status       =request.getParameter("status");
    //！！！id一定要传递过来
    String id =request.getParameter("id");

    String  sql="update tb_product set "
            +" type_id       = '"+typeId+"' "
            +",product_name  = '"+productName+"' "
            +",intro         = '"+intro+"' "
            +",price         = '"+price+"' "
            +",sale_price    = '"+salePrice+"' "
            +",is_top        = '"+isTop+"' "
            +",idx           = '"+idx+"' "
            +",status        = '"+status+"' "
            +" where id      = '"+id+"'";
    DBUtil dbUtil =new DBUtil();
    int n=dbUtil.update(sql);
    if(n>0){
        response.sendRedirect("product.jsp");
    }else {
        out.print("修改失败!");
    }

%>
